home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Original Shareware 1.1
/
The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso
/
18
/
fpc103.zip
/
TOPEDIT.SEQ
< prev
next >
Wrap
Text File
|
1988-06-14
|
3KB
|
100 lines
\ TOPEDIT.SEQ Memory edit. By Tom Zimmer
comment:
Memory edit, allows reentering the editor without having to re-read
the edit file from disk. This results in a much faster turn around time
for development. Changes made during an edit will still be saved at
the end of each edit session.
comment;
only forth also editor also hidden definitions also
handle memfile
: ?readfile ( --- )
edinit
shndl @ memfile over c@ 1+ comp \ if file not the same
edready @ 0= or \ or editor not ready
if read.oldfile \ read the file
shndl @ memfile $>handle \ copy to memfile
sinit \ init mem structure
edready on \ say everything ready
then ;
: cold-edinit ( --- )
defers initstuff
memfile clr-hcb
edready off ;
' cold-edinit is initstuff
only forth definitions also editor also hidden also
: <ed> ( --- ) \ Redefined to work from memory.
?fileopen
?readfile
shndl @ hclose drop
backingup @ renaming !
8 scrline !
reedit
shndl @ memfile $>handle
shndl @ hopen drop \ Reopen file
shndl+ clr-hcb ; \ Clear out the handle above.
comment:
: editany ( --- ) \ watch out here !!
byte|line on \ Byte offset
shndl @ hclose drop
renaming off
8 scrline !
reedit
shndl @ memfile $>handle
shndl @ hopen drop \ Reopen file
shndl+ clr-hcb ; \ Clear out the handle above.
comment;
: sed ( --- )
edinit
byte|line on \ Set to byte offset
backingup @ renaming ! esed ;
: ed ( --- )
>in @ bl word c@ swap >in ! 0>
shndl @ >hndle @ 0< and
if sed
else byte|line on \ Byte offset
<ed>
then cr ;
comment:
\ This routine conflicts with the floating point name FIX, and is
\ thus commented out. You may add it back in if you wish.
: fix ( t1 --- )
view
shndl @ >hndle @ 0>
if ed
then ;
comment;
: edit ( n1 --- ) \ redefined to work from memory.
>in @ bl word c@ swap >in ! 0>
shndl @ >hndle @ 0< and
if depth 0> if drop then sed
else 1 ?enough
byte|line off \ Line to edit
loadline !
<ed>
then ;
: listing ( --- )
?fileopen
edinit renaming off elisting ;
only forth also definitions